#include "../include/drawable.h"
#include "../include/common.h"

void draw_bb(Drawable *d)
{
	ushort x, y;

	ushort yMax	=	d->y + d->bitmap->h;
	ushort xMax	=	d->x + d->bitmap->w;

	uint map	=	d->bitmap->map;
	uint mask	=	1;
	uchar color	=	0;

	for(y = d->y; y < yMax; ++y)
	{
		for(x = d->x; x < xMax; ++x)
		{
			if(mask & map)	color	=	1;
			else			color	=	0;
			
			put_pixel_bb(x, y, color);
			
			mask	<<=	1;
		}
	}
}

void draw(Drawable *d)
{
	ushort x, y;

	ushort yMax	=	d->y + d->bitmap->h;
	ushort xMax	=	d->x + d->bitmap->w;

	uint map	=	d->bitmap->map;
	uint mask	=	1;
	uchar color	=	0;

	for(y = d->y; y < yMax; ++y)
	{
		for(x = d->x; x < xMax; ++x)
		{
			if(mask & map)	color	=	1;
			else			color	=	0;
			
			put_pixel(x, y, color);
			
			mask	<<=	1;
		}
	}
}

int checkCollision(Drawable *d1, Drawable *d2)
{
	if(d1->x == d2->x && d1->y == d2->y)
		return 1;
	else return 0;
}
